﻿using System;
using System.Collections.Generic;
using System.Text;

namespace iPdf
{
    public class TataException: Exception
    {
        public TataException(string message)
            :base(message)
        {
        }

        private string cause = "Unknown";
        public string Cause
        {
            get
            {
                return cause;
            }
            set
            {
                cause = value;
            }
        }

        private string solution = "Unknown";
        public string Solution
        {
            get
            {
                return solution;
            }
            set
            {
                solution = value;
            }
        }

        public override string ToString()
        {
            string str = "Error Message: " + this.Message + Global.Newline;
            str += "Possible Cause: " + this.Cause + Global.Newline;
            str += "Possible Solution: " + this.Solution;
            return str;
        }
    }

    public class ConversionFailed: TataException
    {
        public ConversionFailed(string source, string destinatioin)
            : base(string.Format( global::iPdf.Properties.Resources.ConversionFailed, source, destinatioin))
        {
            Solution = global::iPdf.Properties.Resources.ConversionFailedSolution;
        }
    }

    public class GhostScriptDoesntExist : TataException
    {
        public GhostScriptDoesntExist()
            : base(global::iPdf.Properties.Resources.GhostScriptDoesntExist)
        {
            Solution = global::iPdf.Properties.Resources.GhostScriptDoesntExistSolution;
        }
    }

    public class PdfCreatorDoesntExist : TataException
    {
        public PdfCreatorDoesntExist()
            : base(global::iPdf.Properties.Resources.PdfCreatorDoesntExist)
        {
            this.Cause = global::iPdf.Properties.Resources.PdfCreatorDoesntExistCause;
            this.Solution = global::iPdf.Properties.Resources.PdfCreatorDoesntExistSolution;
        }
    }

    public class InvalidCertificateFile : TataException
    {
        public InvalidCertificateFile()
            : base(global::iPdf.Properties.Resources.InvalidCertificateFile)
        {
            this.Cause = global::iPdf.Properties.Resources.InvalidCertificateFileCause;
            this.Solution = global::iPdf.Properties.Resources.InvalidCertificateFileSolution;
        }
    }

    public class ServiceLoginFailed : TataException
    {
        public ServiceLoginFailed(string serviceName)
            : base(global::iPdf.Properties.Resources.LoginFailed.Replace("{service}", serviceName)) 
        {
            this.Cause = global::iPdf.Properties.Resources.LoginFailedCause.Replace("{service}", serviceName);
            this.Solution = global::iPdf.Properties.Resources.LoginFailedSolution.Replace("{service}", serviceName);
        }
    }

    public class FileAccessFailed : TataException
    {
        public FileAccessFailed(string fileName)
            : base(global::iPdf.Properties.Resources.FileAccessFailed.Replace("{file}", fileName))
        {
            this.Cause = global::iPdf.Properties.Resources.FileAccessFailedCause.Replace("{file}", fileName);
            this.Solution = global::iPdf.Properties.Resources.FileAccessFailedSolution.Replace("{file}", fileName);
        }
    }

    public class UnableToReadImageFile : TataException
    {
        public UnableToReadImageFile(string fileName)
            : base(global::iPdf.Properties.Resources.UnableToReadImageFile.Replace("{file}", fileName))
        {
            this.Cause = global::iPdf.Properties.Resources.UnableToReadImageFileCause.Replace("{file}", fileName);
            this.Solution = global::iPdf.Properties.Resources.UnableToReadImageFileSolution.Replace("{file}", fileName);
        }
    }

    public class ActionCancelled : TataException
    {
        public ActionCancelled()
            : base(global::iPdf.Properties.Resources.ActionCancelled)
        {
            this.Cause = global::iPdf.Properties.Resources.ActionCancelledCause;
        }
    }

}
